package com.jmp.base.enums;

import java.util.HashMap;
import java.util.Map;

public enum TemplateConfigTypeEnum {
    IMG_DIY(0, true, false, false, false),
    CARD_SUNCODE(1, true, false, true, false),
    CARD_IMG(4, true, false, true, false),
    CARD_NAME(5, false, true, true, false),
    CARD_TEL(6, false, true, true, false),
    CARD_POSITION(8, false, true, true, false),
    CARD_EMAIL(9, false, true, true, false),
    CARD_WX_CODE(15, true, false, true, false),
    COMPANY_NAME(2, false, true, false, false),
    COMPANY_IMG(3, true, false, false, false),
    COMPANY_ADDRESS(10, false, true, false, false),
    GOODS_IMG(11, true, false, false, false),
    GOODS_PRICE(12, false, true, false, false),
    GOODS_NAME(13, false, true, false, false),
    GOODS_SUNCODE(14, true, false, false, false),
    ARTICLE_TITLE(16, false, true, false, true),
    ARTICLE_SHARE_URL(17, true, false, false, true),
    ARTICLE_H5_URL(18, true, false, false, false),
    ROOM_NAME(19, false, true, false, false),
    ROOM_PHOTO(20, true, false, false, false),
    ROOM_TYPE(21, false, true, false, false),
    ROOM_SUNCODE(22, true, false, false, false),

    IMG_POST(23, true, false, false, false),

    GROUP_IMG(24, true, false, false, false),
    GROUP_TITLE(25, false, true, false, false),
    GROUP_PRICE(26, false, true, false, false),
    GROUP_H5_URL(27, true, false, false, false),
    ;

    private Integer type;
    private boolean img;
    private boolean font;
    private boolean updateCard;
    private boolean updateArticle;

    TemplateConfigTypeEnum(int type, boolean img, boolean font, boolean updateCard, boolean updateArticle) {
        this.type = type;
        this.img = img;
        this.font = font;
        this.updateCard = updateCard;
        this.updateArticle = updateArticle;
    }

    public int getType() {
        return type;
    }

    public boolean isImg() {
        return img;
    }

    public boolean isFont() {
        return font;
    }

    public boolean isUpdateCard() {
        return updateCard;
    }

    public boolean isUpdateArticle() {
        return updateArticle;
    }

    // Implementing a fromString method on an enum type
    private static final Map<Integer, TemplateConfigTypeEnum> ENUM_MAP = new HashMap<>();

    static {
        // Initialize map from constant name to enum constant
        for (TemplateConfigTypeEnum blah : values()) {
            ENUM_MAP.put(blah.getType(), blah);
        }
    }

    public static TemplateConfigTypeEnum getByType(Integer type) {
        return ENUM_MAP.get(type);
    }
}
